package com.ww.hadoop.mr.topn;

import lombok.extern.slf4j.Slf4j;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Partitioner;

@Slf4j
public class TPartitioner extends Partitioner<TKey, IntWritable> {
    @Override
    public int getPartition(TKey tKey, IntWritable value, int numPartitions) {
        log.info("numPartitions,{}", numPartitions);
        return tKey.getYear() % numPartitions;
    }
}
